/*
day61
2019.10.28
*/
#include<string>
using namespace std;
struct TreeNode
{
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
} ;


class Solution {
public:
	void tree2str(TreeNode* t,string &str)
	{
		if(!t) return ;
		string s=to_string(t->val);
		str += s;
		
		if(t->left||t->right)
		{
			str += "(";
			tree2str(t->left,str);
			str += ")";
		}
		if(t->right)
		{
			str += "(";
			tree2str(t->right,str);
			str += ")";
		}
		
	}
	
    string tree2str(TreeNode* t) 
	{
        string str = "";
        
        tree2str(t,str);
        return str;
    }
};


int main()
{
	
	return 0;
}
 
